The first part of the code simply authenticates with Strava. If the token has expired, it will refresh it.
Token still valid, expires at Sun, 28 Nov 2021 16:11:11 MST
Below is a snapshot of all activities in a dataframe, tabular format. This format is the basis for all of the calculations below.
Looks like you've been a busy bee. I've found 1740 activities. Great! I have everything I need - I'm saving your data to a file called all_activities.csv.
| activity_id | elapsed_hours | name | average_speed | distance | total_elevation_gain | start_date_local | type | year | |
|---|---|---|---|---|---|---|---|---|---|
| date | |||||||||
| 2021-10-09 06:09:49 | 6094941727 | 32.93 | Hallowed | 1.307 | 154897.0 | 4935.0 | 2021-10-09T06:09:49 | Run | 2021 |
I'm processing data from 2015 to 2021
Below are several tables showing the data in aggregated form. Summarizing by
Each activity grabbed from the Strava API with duration translated into ellapsed time that considers total hours (days + hours). You need to adjust that value to plot any activities that run longer than 24 hours (100 milers, fast packs, etc).
Right now strava is returning elapsed time in seconds. However it's missing an extra day if your activity went longer than 24 hours so i'm manually fixing my one record that is >24 hours.
Data summarized by month to show monthly total miles and vert by year and month in a stacked bar plot format. Given I really wasnt' running in 2015 I removed that data.
I'm processing monthly summarized data from 2016 to 2021
'Vertical (Feet) per Month\n 2016-2021'
Below are cumulative summaries for Total Miles and Vertical for all three years starting in 2016 grouped by year for plotting below.
[2021, 2020, 2019, 2018, 2017, 2016]
{'Hike': 'purple', 'Run': 'teal', 'Snow-sport': 'mediumturquoise'}
Here, the data are plotted x vs y to begin to look at trends in pace vs miles vs vert. The few really long runs seem to throw off the data significantly.
Something is up with calculating elapsed hours for the Co trail which was 37 hours or something?
/Users/leahwasser/opt/miniconda3/envs/strava-lyfe/lib/python3.9/site-packages/seaborn/distributions.py:306: UserWarning: Dataset has 0 variance; skipping density estimate. /Users/leahwasser/opt/miniconda3/envs/strava-lyfe/lib/python3.9/site-packages/seaborn/distributions.py:306: UserWarning: Dataset has 0 variance; skipping density estimate. /Users/leahwasser/opt/miniconda3/envs/strava-lyfe/lib/python3.9/site-packages/seaborn/distributions.py:306: UserWarning: Dataset has 0 variance; skipping density estimate.
https://stackoverflow.com/questions/63459424/how-to-add-multiple-graphs-to-dash-app-on-a-single-browser-page really helpful
Me just playing with dash here